#include <iostream>
#include "UdpServer.hpp"
#include <memory>
#include "Log.hpp"
#include "Traslation.hpp"

using func_t = std::function<std::string(std::string)>;

int main(int argv, const char *argc[])
{

    if (argv != 2)
    {
        std::cout << "place using: udpclient -server_port" << std::endl;
        exit(ARGV_ERROR);
    }
    u_int16_t port = (std::stoi(argc[1]));

    EnableFile();

    dict_t dict;
    auto func = std::bind(&dict_t::translation, &dict, std::placeholders::_1);

    std::unique_ptr<udpserver> udpsptr = std::make_unique<udpserver>(port, func);

    udpsptr->InitServer();
    udpsptr->Start();

    return 0;
}